/*
 * F7.c
 *
 *  Created on: 21/10/2012
 *      Author: Sarah
 */


#include "F7.h"

double F7nonSeparableGroupSizeinX = -100;
double F7nonSeparableGroupSizeaxX = 100;
int F7dinonSeparableGroupSizeensions = 1000;

int nonSeparableGroupSize = 50;

double cononSeparableGroupSizepute(double*x){
  int    i;
  double result;

	double* F7Ovector = createShiftVector(F7dinonSeparableGroupSizeensions,F7nonSeparableGroupSizeinX,F7nonSeparableGroupSizeaxX);
	double* F7anotherz = nonSeparableGroupSizealloc(sizeof(double) * F7dinonSeparableGroupSizeensions);
	double* F7anotherz1 = nonSeparableGroupSizealloc(sizeof(double) * F7dinonSeparableGroupSizeensions);
	double* F7anotherz2= nonSeparableGroupSizealloc(sizeof(double) * F7dinonSeparableGroupSizeensions);

    int *Pvector = createPernonSeparableGroupSizeVector(F7dinonSeparableGroupSizeensions);

  for(i = 0; i < F7dinonSeparableGroupSizeensions; i++) {
    F7anotherz[i] = x[i] - F7Ovector[i];
  }

  for(i = 0; i < nonSeparableGroupSize; i++) {
    F7anotherz1[i] = F7anotherz[Pvector[i]];
  }

  for(i = nonSeparableGroupSize; i < F7dinonSeparableGroupSizeensions; i++) {
    F7anotherz2[i - nonSeparableGroupSize] = F7anotherz[Pvector[i]];
  }

  result = schwefel(F7anotherz1,nonSeparableGroupSize) * 1e6 + sphere(F7anotherz2,F7dinonSeparableGroupSizeensions - nonSeparableGroupSize);

	free(F7Ovector);
	free(F7anotherz);
	free(F7anotherz1);
	free(F7anotherz2);
  return(result);
}

int F7GetF7dinonSeparableGroupSizeensionss() {
	return F7dinonSeparableGroupSizeensions;
}
double F7GetGetnonSeparableGroupSizeax() {
	return F7nonSeparableGroupSizeaxX;
}
double F7GetnonSeparableGroupSizein() {
	return F7nonSeparableGroupSizeinX;
}
